// eslint-disable-next-line
import { UserLayout, BasicLayout, BlankLayout } from '@/layouts'

const RouteView = {
  name: 'RouteView',
  render: h => h('router-view')
}

export const asyncRouterMap = [
  {
    path: '/',
    name: 'index',
    component: BasicLayout,
    meta: { title: '首页' },
    redirect: '/home',
    children: [
      // 首页
      {
        path: '/home',
        name: 'Home',
        component: () => import('@/views/Home'),
        meta: { title: '首页', keepAlive: true, icon: 'home'}
      },
      // 管理员
      {
        path: '/admin',
        name: 'Admin',
        component: RouteView,
        redirect: '/admin/users',
        meta: { title: '管理员管理', icon: 'user', keepAlive: true },
        children: [
          {
            path: '/admin/users',
            name: 'AdminList',
            component: () => import('@/views/admin/AdminList'),
            meta: { title: '管理员列表', keepAlive: true, path: '/admin/users', method: 'GET' },
            hideChildrenInMenu: true
          },
          {
            path: '/admin/roles',
            name: 'RoleList',
            component: () => import('@/views/admin/RoleList'),
            meta: { title: '角色列表', keepAlive: true },
            hideChildrenInMenu: true
          },
          {
            path: '/admin/permissions',
            name: 'PermissionList',
            component: () => import('@/views/admin/PermissionList'),
            meta: { title: '菜单权限列表', keepAlive: true },
            hideChildrenInMenu: true
          }
        ]
      }
      // 用户
      // {
      //   path: '/member',
      //   name: 'Member',
      //   component: RouteView,
      //   redirect: '/member/list',
      //   meta: { title: '用户管理', icon: 'user', keepAlive: true },
      //   children: [
      //     {
      //       path: '/member/list',
      //       name: 'MemberList',
      //       component: () => import('@/views/member/MemberList'),
      //       meta: { title: '用户列表' },
      //       hideChildrenInMenu: true,
      //     },
      //   ]
      // },
      // 活动
      // {
      //   path: '/activity',
      //   name: 'activity',
      //   component: RouteView,
      //   redirect: '/activity/list',
      //   meta: { title: '活动管理', icon: 'flag' },
      //   children: [
      //     {
      //       path: '/activity/list',
      //       name: 'ActivityList',
      //       component: () => import('@/views/activity/ActivityList'),
      //       meta: { title: '活动列表' }
      //     },
      //     {
      //       path: '/activity/create',
      //       name: 'CreateActivity',
      //       hidden: true,
      //       component: () => import('@/views/activity/CreateActivity'),
      //       meta: { title: '活动列表' }
      //     }
      //   ]
      // }
    ]
  }
]

/**
 * 基础路由
 * @type { *[] }
 */
export const constantRouterMap = [
  {
    path: '/user',
    component: UserLayout,
    redirect: '/user/login',
    hidden: true,
    children: [
      {
        path: 'login',
        name: 'login',
        component: () => import(/* webpackChunkName: "user" */ '@/views/user/Login')
      }
    ]
  },

  {
    path: '/404',
    component: () => import(/* webpackChunkName: "fail" */ '@/views/exception/404')
  }
]
